﻿#region Imports

using System.Collections.Generic;
using d3PrtDgn.Core.BaseData;
using d3PrtDgn.Data.Domain.Entity;

#endregion

namespace d3PrtDgn.Data.IDAO
{
	/// <summary>
	/// Album data access object interface
	/// </summary>
    public interface IAlbumDao : IBaseDao
    {
		/// <summary>
		/// Saves or updates album
		/// </summary>
		/// <param name="album"></param>
		/// <returns></returns>
    	Album SaveOrUpdate(Album album);

		/// <summary>
		/// Loads all albums
		/// </summary>
		/// <returns></returns>
		IList<Album> FindAll();

		/// <summary>
		/// Loads all users albums
		/// </summary>
		/// <param name="owner">Album owner</param>
		/// <returns></returns>
		IList<Album> FindAllForOwner(User owner);

		/// <summary>
		/// Loads one album with desired id
		/// </summary>
		/// <param name="id">ID to search for</param>
		/// <param name="owner">Album owner</param>
		/// <returns>Found album</returns>
		Album FindById(int id, User owner);

		/// <summary>
		/// Loads album acoording to abbreviation,
		/// checks owner on private album if supplied
		/// </summary>
		/// <param name="abbrev">Album abbreviation</param>
		/// <param name="owner">Album owner</param>
		/// <returns></returns>
		Album FindByAbbreviation(string abbrev, User owner);

		/// <summary>
		/// Deletes album
		/// </summary>
		/// <param name="album">Album to delete</param>
		void Delete(Album album);

		/// <summary>
		/// Finds public albums in desired category
		/// </summary>
		/// <returns>List of all found albums</returns>
		IList<Album> FindAllPublic();

		/// <summary>
		/// Finds public albums in desired category
		/// </summary>
		/// <param name="category">Category od albums</param>
		/// <returns>Albums in specified category</returns>
		IList<Album> FindPublicByCategory(Category category);

		/// <summary>
		/// Finds all albums in specified category for current user
		/// </summary>
		/// <param name="category">Album category</param>
		/// <param name="user">User</param>
		/// <returns>List of all albums in specified category for current user</returns>
		IList<Album> FindAllByCategory(Category category, User user);

		/// <summary>
		/// Loads all albums visible for user
		/// </summary>
		/// <param name="user">User</param>
		/// <returns>Visible albums for specified user</returns>
		IList<Album> FindAllVisible(User user);

		/// <summary>
		/// Checks if album abbreviation is unique
		/// </summary>
		/// <param name="abbreviation">Abbreviation to check</param>
		/// <param name="id">ID of album to ignore</param>
		/// <returns>Flag if abbreviation is unique</returns>
    	bool IsUnique(string abbreviation, int id);
    }
}
